var _gMap = new Map(); // 空Map
function getBeanArrFromSeverCache(cacheName)
{
	if(public_isEmpty(cacheName))
		return null;
	var beanArr = _gMap.get(cacheName);
	if(beanArr==null) {
		var ret = public_getServerData(base+"/sys/framework/action/cache/my/controller/cache/getEntityListFromCache",{cacheName:cacheName});
		if(ret.ok) {
			_gMap.set(cacheName, ret.data);
			beanArr = ret.data;
		}
	}
	return beanArr;
}

function getBeanFromSeverCache(id,cacheName)
{
	if(public_isEmpty(cacheName) || public_isEmpty(id))
		return null;
	var beanArr = getBeanArrFromSeverCache(cacheName);
	if(beanArr!=null && beanArr.length>0) {
		for(var i=0;i<beanArr.length;i++) {
			var bean = beanArr[i];
			if(bean.id==id) {
				return bean;
			}
		}
	}
	return null;
}

function getNameFromBeanArr(id,beanArr) 
{
	var arr = beanArr;
	if(arr!=null && arr.length>0) {
		for(var i=0;i<arr.length;i++) {
			var bean = arr[i];
			if(bean.id==id) {
				return bean.name;
			}
		}
	}
	return "";
}

function commonRender(e) {
	if(e && e.column && !public_isEmpty(e.column.cacheName)) {
		var id = e.value;
		var cacheName = e.column.cacheName;
//		var localCache = eval("fzzlMyCache_" + cacheName);
//		if(localCache != null && localCache != undefined) {
//			return getNameFromCache(id,localCache);
//		} else {
//			return getNameById(id,cacheName);
//		}
		return getNameById(id,cacheName);
	}
}

function getNameById(id,cacheName,jsonContent) {
	if(!public_isEmpty(id) && !public_isEmpty(cacheName)) {
		var cache = null;
		if(jsonContent==null) {
			cache = getBeanArrFromSeverCache(cacheName);
		} else {
			cache = jsonContent;
		}
		return getNameFromCache(id,cache);
	}
}

function getNameFromCache(id,cache) {
	var name = getNameFromBeanArr(id,cache);
	//console.pojoContrast(id + ":" + name);
	return public_isEmpty(name) ? id : name;
}

